import 'package:finance_app/src/entities/reconciliation_item_entity.dart';

reconciliationItemEntityFromJson(ReconciliationItemEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['company_id'] != null) {
		data.companyId = json['company_id'] is String
				? int.tryParse(json['company_id'])
				: json['company_id'].toInt();
	}
	if (json['account_id'] != null) {
		data.accountId = json['account_id'] is String
				? int.tryParse(json['account_id'])
				: json['account_id'].toInt();
	}
	if (json['start_date'] != null) {
		data.startDate = json['start_date'].toString();
	}
	if (json['end_date'] != null) {
		data.endDate = json['end_date'].toString();
	}
	if (json['beginning_balance'] != null) {
		data.beginningBalance = json['beginning_balance'].toString();
	}
	if (json['deposit'] != null) {
		data.deposit = json['deposit'].toString();
	}
	if (json['withdraw'] != null) {
		data.withdraw = json['withdraw'].toString();
	}
	if (json['statement_balance'] != null) {
		data.statementBalance = json['statement_balance'].toString();
	}
	if (json['status'] != null) {
		data.status = json['status'].toString();
	}
	if (json['created_at'] != null) {
		data.createdAt = json['created_at'].toString();
	}
	if (json['updated_at'] != null) {
		data.updatedAt = json['updated_at'].toString();
	}
	return data;
}

Map<String, dynamic> reconciliationItemEntityToJson(ReconciliationItemEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['company_id'] = entity.companyId;
	data['account_id'] = entity.accountId;
	data['start_date'] = entity.startDate;
	data['end_date'] = entity.endDate;
	data['beginning_balance'] = entity.beginningBalance;
	data['deposit'] = entity.deposit;
	data['withdraw'] = entity.withdraw;
	data['statement_balance'] = entity.statementBalance;
	data['status'] = entity.status;
	data['created_at'] = entity.createdAt;
	data['updated_at'] = entity.updatedAt;
	return data;
}